{% extends 'base.html' %}

{% block page-main %}
    <div style="text-align: center;">
        <h1>{{ article_obj.title }}</h1>
    </div>
    <div class="super_content">
        {{ article_obj.content.content|safe }}
        <br>
        <hr class="hr_split">
        {#评论内容#}
        {% for comment in article_obj.comments.all %}
            <div class="col-sm-12 doc_node">
                <div class="media message_boxunit pull-left">
                    <div class="doc_node_content"
                         style="margin: 4px;">{{ comment.commentator.name }}说：{{ comment.content }}</div>
                    <span class="side_unit_info pull-left">
					    {{ comment.create_time }}
					</span>
                </div>
            </div>
        {% endfor %}

        {#评论框#}
        {% if request.user_obj %}
            <form role="form" action="{% url 'comment' %}" id="knowSubmitFormId" class="wcp_noEnterSubmit"
                  method="post">
                {% csrf_token %}

                <div class="row">
                    <div class="col-md-12">
                        <div class="form-group">
                            <textarea class="form-control" id="mesTextId" name="comment" placeholder="我要评论"></textarea>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-12">
                        <button type="submit">提交评论</button>
                    </div>
                </div>
            </form>
        {% else %}
            <form role="form" action="" id="knowSubmitFormId" class="wcp_noEnterSubmit"
                  method="post">

                <div class="row">
                    <div class="col-md-12">
                        <div class="form-group">
                    <textarea class="form-control" id="mesTextId" name="content" disabled="disabled"
                              placeholder="请登陆后发表评论"></textarea>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-12 text-center">
                        <a href="{% url 'login' %}" class="btn btn-primary">登陆后发表评论</a>

                    </div>
                </div>
            </form>
        {% endif %}
    </div>

{% endblock %}